Skip to content

Freeze the install-ID file loader's behaviour in fixtures - #42

Merged
dmccoystephenson merged 1 commit into
mainfrom
test/install-id-fixtures
Nov 21, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
test/install-id-fixtures

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

What

  • tests/install-id-fixtures/: the shared trace-client install-ID corpus (20 *.id files) and expected.txt, which records what TraceClient.InstallIdFromFile does with each file. A .gitattributes line (tests/install-id-fixtures/** binary) keeps CRLF, BOM and non-UTF-8 bytes exactly as written.
  • InstallIdFixturesTest: for every expected.txt line, the fixture is copied into a fresh temp directory and the loader is called there. loaded means the returned ID matches and the file is byte-identical. replaced means a lowercase uuid4 is returned and the file now holds exactly that ID plus \n. kept means the file is byte-identical and the returned uuid4 does not appear in it. The test also fails if the *.id files in the directory differ from the set expected.txt names.
  • VersionConsistencyTest: checks that TraceClient.csproj's <Version> matches the TraceClient.cs header (trace-client X --), const string Version = "X" and the README's trace-client/X (, and that each appears exactly once.
  • SourceTree helper: finds the repository root from the test assembly by walking up to TraceClient.sln, so the fixtures are read from the source tree on Linux, Windows and .NET Framework alike.
  • README: a note that released fixtures are frozen and that a new case is a new fixture plus its expected.txt line.

The client source and version are unchanged.

Why

The fleet's release automation will soon check install IDs before every release. It requires each released fixture to stay byte-identical, each released loaded/kept line in expected.txt to stay unchanged, and CI (which runs this test) to be green on the tagged commit. An ID that a previous release stored must keep loading as the same ID, and a file the loader cannot read must never be overwritten.

Measured classification

Each line was found by running a throwaway harness outside the repository. The harness called InstallIdFromFile on a copy of each fixture, once against the 0.4.0 tag and once against main. Both runs gave identical results:

  • loaded: created, plain, trailing-newline, crlf, padded, tabs, uppercase-uuid, max-length, leading-blank-lines, first-of-two, invalid-lines-first (third.is-valid), comment-first (real-id), bom (bom-id), id-then-not-utf8 (good-id)
  • replaced: empty, whitespace-only, too-long, bad-chars, non-ascii, not-utf8
  • kept: none

Differences from trace-client-python:

  • bom.id is loaded as bom-id, where Python replaces it. File.ReadAllLines strips the UTF-8 byte order mark.
  • not-utf8.id is replaced, where Python keeps it. Its leading FF FE is taken as a UTF-16LE byte order mark, the bytes decode without error, and no line is a valid ID.
  • id-then-not-utf8.id is loaded as good-id, where Python keeps it. .NET substitutes U+FFFD for invalid bytes rather than failing, and the first line is already a valid ID.

Because of this, no fixture in the corpus is kept for this client. Unreadable paths (for example, a directory where the file should be) are still left alone, as the existing InstallIdTest covers.

Testing

  • dotnet test -c Release -p:IncludeNetFramework=false on .NET 8 SDK 8.0.424 (Linux): 189 passed. The new tests account for 23 of them.
  • As a negative check, one expected.txt outcome was changed and a stray extra.id was added. Both new fixture tests failed as intended, and the files were then restored.
  • git show HEAD:tests/install-id-fixtures/crlf.id | xxd shows 0d0a, and bom.id starts with efbbbf.
  • .NET Framework 4.8 is covered by the Windows CI job.

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

Add tests/install-id-fixtures: the shared trace-client install-ID corpus
(stored as binary via .gitattributes) and expected.txt, recording what
InstallIdFromFile at release 0.4.0 does with each file. InstallIdFixturesTest
replays every line against the loader, and VersionConsistencyTest checks that
every written version agrees with TraceClient.csproj. The README notes that
released fixtures are frozen.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dmccoystephenson
dmccoystephenson merged commit 3f02ced into main Nov 21, 2026
2 checks passed
@dmccoystephenson
dmccoystephenson deleted the test/install-id-fixtures branch November 21, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant